<?php

/**
 * 上传附件
 * @copyright   Copyright (c) 2006 - 2010 DZH 友拓软件友拓通
 * @category    基本信息
 * @package   Model
 * @author     庄敏学
 * @version  2.1,2012-07-22
 */

class GalleryPublicModel extends Model {
	protected $tableName = 'gallery';
	/**
	 * 根据tocken值，更新图片关联信息
	 * @param int $relation_id
	 * @param string $tocken
	 * @return bool
	 */
	function update($relation_id,$tocken){
		$sql = 'update __TABLE__ set relation_id='.$relation_id.',tocken=\'\' where tocken=\''.$tocken.'\'';
		return $this->execute($sql);
	}
	
	/**
	 * 获取图片信息数组
	 * @param int $relation_id
	 * @param string $relation_type
	 * @return array
	 */
	function getAry($relation_id,$relation_type){
		return $this->where('relation_type='.$relation_type.' and relation_id='.$relation_id)->select();
	}
	
}